<?php
class My_Message
{
	public static function get($id)
	{
		$xmlFile = APPLICATION_PATH."/resource/message.xml";
        if (is_readable( $xmlFile ) == false)
        {
            throw new Exception("Can not open the file: '".
                                                $xmlFile."'");
            return;
        }
        $subId = explode( "|", $id );
        $msgCode    = $subId[0];
        if( mb_strlen( $msgCode ) <= 0 )
        {
            return;
        }
        unset( $subId[0] );
        $message = "";
        try {
        	$msgConfig = new Zend_Config_Xml( $xmlFile, $msgCode);
        }catch (Zend_Exception $e)
        {
        	$message = $msgCode;
        }
        if($message!= $msgCode)
        {
            //-------------------------------------------------------//
            //Message Id is defined
            //-------------------------------------------------------//
            $message = $msgConfig->$msgCode;
            if( empty( $subId ) == FALSE )
            {
                $message = vsprintf( $message, $subId );
            }
        }
        return $message;
	}
}
?>